//
//  RootViewController.m
//  HideNavigationBar
//
//  Created by Naoki TSUTSUI on 10/02/05.
//  Copyright iphoneworld.jp 2010. All rights reserved.
//

#import "RootViewController.h"
#import "TouchableViewController.h"

@implementation RootViewController
@synthesize touchableViewController;
@synthesize dataArray;

- (void)dealloc {
  [dataArray release];
  [touchableViewController release];
  [super dealloc];
}

- (void)viewDidLoad {
  [super viewDidLoad];
  
  dataArray = [NSMutableArray array];
  [dataArray addObject:@"タップ検出画面に移動"];
}

- (void)viewWillAppear:(BOOL)animated {
  [super viewWillAppear:animated];
  
  [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
  self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
}

- (void)viewDidAppear:(BOOL)animated {
  [super viewDidAppear:animated];
}

/*
- (void)viewWillDisappear:(BOOL)animated {
	[super viewWillDisappear:animated];
}
*/
/*
- (void)viewDidDisappear:(BOOL)animated {
	[super viewDidDisappear:animated];
}
*/

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
  [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release anything that can be recreated in viewDidLoad or on demand.
	// e.g. self.myOutlet = nil;
}


#pragma mark Table view methods

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
  return 1;
}

// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  return 1;
}

// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
  static NSString *CellIdentifier = @"Cell";
    
  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 
                                   reuseIdentifier:CellIdentifier] autorelease];
  }
    
	// Configure the cell.
  cell.textLabel.text = [dataArray objectAtIndex:indexPath.row];

  return cell;
}

// Override to support row selection in the table view.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  touchableViewController = [[TouchableViewController alloc] 
                             initWithNibName:@"TouchableViewController" 
                                      bundle:nil];
  
  [self.navigationController pushViewController:touchableViewController animated:YES];
}
@end

